2 * Adium is the legal property of its developers, whose names are listed in the copyright file included
3 * with this source distribution.
5 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
6 * General Public License as published by the Free Software Foundation; either version 2 of the License,
7 * or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
10 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11 * Public License for more details.
13 * You should have received a copy of the GNU General Public License along with this program; if not,
14 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 #import "ESPurpleYahooAccountViewController.h"
18 #import "ESPurpleYahooAccount.h"
19 #import <Adium/AIAccount.h>
20 #import <AIUtilities/AIPopUpButtonAdditions.h>
21 #import <AIUtilities/AIMenuAdditions.h>
23 @interface ESPurpleYahooAccountViewController (PRIVATE)
24 - (NSMenu *)chatServerMenu;
27 @implementation ESPurpleYahooAccountViewController
32 - (NSString *)nibName{
33 return @"ESPurpleYahooAccountView";
37 * @brief Awake from nib
42 [popUp_chatServer setMenu:[self chatServerMenu]];
46 * @brief Configure controls
48 - (void)configureForAccount:(AIAccount *)inAccount
50 [super configureForAccount:inAccount];
52 [popUp_chatServer selectItemWithRepresentedObject:[inAccount preferenceForKey:KEY_YAHOO_ROOM_LIST_LOCALE
53 group:GROUP_ACCOUNT_STATUS]];
57 * @brief Save controls
59 - (void)saveConfiguration
61 [super saveConfiguration];
63 [account setPreference:[[popUp_chatServer selectedItem] representedObject]
64 forKey:KEY_YAHOO_ROOM_LIST_LOCALE
65 group:GROUP_ACCOUNT_STATUS];
68 - (NSMenu *)chatServerMenu
70 NSMenu *chatServerMenu = [[NSMenu allocWithZone:[NSMenu zone]] init];
71 NSMutableArray *menuItems = [NSMutableArray array];
73 NSEnumerator *enumerator;
75 NSDictionary *roomListServersDict;
77 roomListServersDict = [NSDictionary dictionaryWithObjectsAndKeys:
83 @"Central African Republic", @"cf",
85 /* @"Germany", @"de",*/
92 @"Korea, Republic of", @"kr",
98 @"United Kingdom", @"uk",
101 menuItem = [[[NSMenuItem allocWithZone:[NSMenu menuZone]] initWithTitle:AILocalizedString(@"United States",nil)
104 keyEquivalent:@""] autorelease];
105 [menuItem setRepresentedObject:@"us"];
106 [menuItems addObject:menuItem];
108 enumerator = [roomListServersDict keyEnumerator];
109 while ((prefix = [enumerator nextObject])) {
110 menuItem = [[[NSMenuItem allocWithZone:[NSMenu menuZone]] initWithTitle:[roomListServersDict objectForKey:prefix]
113 keyEquivalent:@""] autorelease];
114 [menuItem setRepresentedObject:prefix];
115 [menuItems addObject:menuItem];
118 [menuItems sortUsingSelector:@selector(titleCompare:)];
120 enumerator = [menuItems objectEnumerator];
121 while ((menuItem = [enumerator nextObject])) {
122 [chatServerMenu addItem:menuItem];
125 return [chatServerMenu autorelease];